/*
moxl - Modular XML Library
Copyright (c) 2007, Malcolm Sparks

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
package moxl.parser.model;

import java.util.List;

import moxl.raw.RawDocument;
import moxl.raw.RawNode;
import moxl.raw.XmlResource;

public class ParsedDocument implements RawDocument
{
	ParsedElement documentElement;
	List<RawNode> preamble;
	List<RawNode> postamble;
	private final XmlResource resource;

	public ParsedDocument(XmlResource resource)
	{
		this.resource = resource;
	}

	public ParsedElement getDocumentElement()
	{
		return documentElement;
	}

	void setDocumentElement(ParsedElement documentElement)
	{
		if (this.documentElement != null)
		{
			// Defensive check: Our well formed checker would have thrown an exception already by now.
			throw new IllegalStateException("Internal Error: Document already has a document element set against it.");
		}
		this.documentElement = documentElement;
	}

	public void setPreamble(List<RawNode> preamble)
	{
		this.preamble = preamble;
	}

	public void setPostamble(List<RawNode> postamble)
	{
		this.postamble = postamble;
	}

	public XmlResource getResource()
	{
		return resource;
	}

}
